package com.iptv.grape.event.data;

import com.iptv.grape.bu.GrapeContext;
import com.iptv.grape.domain.Channel;
import com.iptv.grape.util.CommUtil;

import java.util.Date;

// 时移数据上报
public class TimeLiveData {
    // 逻辑频道号
    private String channelID;
    // 频道名称
    private String channelName;
    // 时移节目操作类型(0：播放;1：快进;2：快退;3：暂停)
    private int programOperateType;
    // 播放速率(无倍速，此字段为空)
    private String pace;
    // 进入退出（0：进入；1：退出）
    private String state;

    private String reserve1;
    private String reserve2;


    private static TimeLiveData curTimeLiveData = null;

    public static TimeLiveData getCurTimeLiveData() {
        return curTimeLiveData;
    }

    public static void createTimeLiveData(){
        Channel channel = GrapeContext.curGrapeContext().getChannelDLinkList().getCurChannel();
        if(channel != null) {
            TimeLiveData timeLiveData = new TimeLiveData();
            timeLiveData.channelID = channel.getChannelNo() + "";
            timeLiveData.channelName = channel.getName();
            timeLiveData.programOperateType = 0;
            timeLiveData.state = "0";
            curTimeLiveData = timeLiveData;
        }
        else {
            curTimeLiveData = null;
        }
    }


    public String getChannelID() {
        return channelID;
    }

    public void setChannelID(String channelID) {
        this.channelID = channelID;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public int getProgramOperateType() {
        return programOperateType;
    }

    public void setProgramOperateType(int programOperateType) {
        this.programOperateType = programOperateType;
    }

    public String getPace() {
        return pace;
    }

    public void setPace(String pace) {
        this.pace = pace;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getReserve1() {
        return reserve1;
    }

    public void setReserve1(String reserve1) {
        this.reserve1 = reserve1;
    }

    public String getReserve2() {
        return reserve2;
    }

    public void setReserve2(String reserve2) {
        this.reserve2 = reserve2;
    }

    public String getStartTime() {
        return CommUtil.formatDate(new Date(),"yyyyMMddHHmmss");
    }
}
